﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.ServiceModel;
using System.Text;
using Olitee.WorkScheduler.Service;

namespace Olitee.SchedulerWCFService
{
    public partial class WorkSchedulerService : ServiceBase
    {
        SchedulerService _schedulerService;
        ServiceHost _serviceHost;

        public WorkSchedulerService()
        {
            InitializeComponent();
        }

        /// <summary>
        /// A debug start method that is called only in debug mode.
        /// </summary>
        public void OnDebugStart()
        {
            OnStart(null);
        }

        protected override void OnStart(string[] args)
        {
            _schedulerService = new SchedulerService();
            _serviceHost = new ServiceHost(_schedulerService);
            _serviceHost.Open();
        }

        protected override void OnStop()
        {
            _serviceHost.Close();
        }
    }
}
